package cn.wolfcode.shop.cloud.config;

import cn.wolfcode.shop.cloud.resolver.UserArgumentsResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

@Configuration
public class UserArgumentsResolverConfig implements WebMvcConfigurer {
    @Autowired
    private UserArgumentsResolver userArgumentsResolver;

    @Bean
    public UserArgumentsResolver userArgumentsResolver(){
        return new UserArgumentsResolver();
    }

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
        resolvers.add(userArgumentsResolver);
    }
}
